#include<iostream>
using namespace std;
typedef long long LL;
const int N = 21;
LL f[N];
int n, m;
int main()
{
	cin >> n >> m;
	cout << min(n, m) << endl;
	if (m > n) {
		swap(n, m);
	}
	f[0] = 1;
	for (int i = 1; i < N; i++) {
		f[i] = f[i - 1] * i;
	}
	LL ans = f[n] / f[n - m];
	cout << ans << endl;
	return 0;
}